package com.jky.trial.mapper;

import com.jky.trial.entity.Relation;
import com.jky.trial.entity.User;
import com.jky.trial.entity.UserExample;
import com.jky.trial.vo.CategoryVo;
import com.jky.trial.vo.UserVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {
    long countByExample(UserExample example);

    int deleteByExample(UserExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(User record);

    int insertSelective(User record);

    List<User> selectByExample(UserExample example);

    /**
     * 根据权限名称获取用户列表
     * <p>
     * required record.name 权限名称
     *
     * @param record
     * @return
     */
    List<User> listByPermission(CategoryVo record);

    /**
     * record.remark =  'target_id' 或者'source_id'
     * @param record
     * @return
     */
    List<UserVo> listByRelation(Relation record);


    User selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    List<UserVo> pageList(UserVo example);

    /**
     * 获取id项目的机组成员
     * @param id
     * @return
     */
    List<UserVo> jzMember(Integer id);

    /**
     * record.categoryType category类型
     * record.size
     * record.page
     *
     * @param record
     * @return
     */
    List<UserVo> pageListWithDep(UserVo record);

}